//
//  PublicClass.h
//  TravelHome
//
//  Created by 王宏 on 16/6/1.
//  Copyright © 2016年 王宏. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import <AssetsLibrary/ALAsset.h>
@interface PublicClass : NSObject
///颜色转图片
+ (UIImage *)imageWithColor:(UIColor *)color;
///颜色便利设置
+ (UIColor *)colorWithRed:(CGFloat)red green:(CGFloat)green blue:(CGFloat)blue alpha:(CGFloat)alpha;
///验证密码
+ (BOOL)isPassword:(NSString *)text;
///MD5加密
+ (NSString *) md5:(NSString *)str;
///手机号验证
+ (BOOL)isPhoneNumber:(NSString *)number;
//验证字符串是否为空
+ (BOOL)stringIsEmpty:(NSString *)str;
//获取当前系统日期
+ (NSString *)getsTheCurrentSystemDate;
//根据十六进制设置颜色
+ (UIColor *) stringTOColor:(NSString *)str;
//改变某段文字颜色
+ (NSMutableAttributedString *)changeSomeTextColorWithText:(NSString *)allStr targetStr:(NSString *)targetStr color:(UIColor *)color fontSize:(CGFloat)fontSize;
//给label设置不同的颜色和字体
+ (void)theRichTextLabel:(UILabel *)label color:(UIColor *)color range:(NSRange)range font:(UIFont*)font;
//将时间戳转换为时间
+ (NSString *)TheTimeStampConversionStr:(double)str;
//将时间戳转换为时间(具体到时分)
+ (NSString *)TheTimeStampConversionMinutesStr:(double)str;
//根据时间戳获取星期几
+ (NSString *)getWeekDayFordate:(double)str;
//json转dictionary
+ (NSDictionary *)dictionaryWithJsonString:(NSString *)jsonString;
//给视图添加一侧的边框线
+ (void)setViewBorderWithView:(UIView *)view top:(BOOL)top left:(BOOL)left bottom:(BOOL)bottom right:(BOOL)right borderColor:(UIColor *)color borderWidth:(CGFloat)width;
//给标签添加一侧的边框线
+ (void)setLabelBorderWithLabel:(UILabel *)view top:(BOOL)top left:(BOOL)left bottom:(BOOL)bottom right:(BOOL)right borderColor:(UIColor *)color borderWidth:(CGFloat)width;
//给按钮添加一侧的边框线
+ (void)setButtonBorderWithButton:(UIButton *)button top:(BOOL)top left:(BOOL)left bottom:(BOOL)bottom right:(BOOL)right borderColor:(UIColor *)color borderWidth:(CGFloat)width;
//类名反射
+ (id)classNameFromString:(NSString *)classNameStr;
//冒泡排序
+(void)bubbleSort:(NSMutableArray *)list;
//改变图片尺寸
+ (UIImage*)imageWithImageSimple:(UIImage*)image scaledToSize:(CGSize)newSize;
//获取缓存大小
+(CGFloat)getCacheSize:(NSString*)allfileCachePath;
//清除缓存
+(void)cleanCache:(NSString*)allfileCachePath;
//获取传入时间和当前时间的时间差
+(NSDateComponents *)TheCurrentTime:(NSString*)stopTime;
//替换非utf8字符
//注意：如果是三字节utf-8，第二字节错误，则先替换第一字节内容(认为此字节误码为三字节utf8的头)，然后判断剩下的两个字节是否非法；
+ (NSData *)replaceNoUtf8:(NSData *)data;
//字典转json
+(NSString *)dictToJsonStr:(NSDictionary *)dict;
//将view转换为image
+(UIImage *)getImageFromView:(UIView *)theView;
//银行卡号验证
+ (BOOL)IsBankCard:(NSString *)cardNumber;
//抖动动画
+ (void)beginJitterAnimation:(UIView*)view;
//对日期进行排序
+ (NSArray *)compareNsdate:(NSArray *)array;
//判断字符串是否为纯汉字
+ (BOOL)isChinese:(NSString*)str;
//判读字符串里面是不是只包含数字
+ (BOOL)isPureInt:(NSString *)string;
//将彩色图片转换为黑白
+ (UIImage*)convertImageToGreyScale:(UIImage*)image;
//计算字符串长度
+(NSUInteger)textLength: (NSString *)text;
//旋转屏幕
+ (void)interfaceOrientation:(UIInterfaceOrientation)orientation;
@end
